package javaAdvanced;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;

/**
 * 类的描述信息
 *
 * @author cuiH
 * Date: 13-12-3
 */
public class ReflectApply {
    public static void main(String[] args) {

        ReflectPoint pt1 = new ReflectPoint(3, 3);
        ReflectPoint pt2 = new ReflectPoint(10, 15);
        ReflectPoint pt3 = new ReflectPoint(3, 3);

        Collection<ReflectPoint> arrayList = new ArrayList<ReflectPoint>();             //面向借口编程或者面向父类编程规范
        arrayList.add(pt1);
        arrayList.add(pt2);
        arrayList.add(pt3);
        arrayList.add(pt1);
        System.out.println("arrayList的大小：" + arrayList.size());

        Collection<ReflectPoint> hashSet = new HashSet<ReflectPoint>();
        hashSet.add(pt1);
        hashSet.add(pt2);
        hashSet.add(pt3);
        hashSet.add(pt1);
        System.out.println("hashSet的大小：" + hashSet.size());     //排除重复的：最初显示为：3

        /**
         * 重写了hashCode和Equals方法之后比较hashSet显示为  2
         * 注掉hashCode的重写之后hashSet显示为    3
         */



    }
}
